package com.wnxy.sddfp.search.controller;

import com.wnxy.sddfp.common.model.page.Pages;
import com.wnxy.sddfp.common.result.Result;
import com.wnxy.sddfp.search.model.query.BorrowSearchQuery;
import com.wnxy.sddfp.search.model.vo.BorrowVO;
import com.wnxy.sddfp.search.service.BorrowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@Api(tags = "搜索服务")
public class SearchController {

    @Autowired
    private BorrowService borrowService;

    /**
     * 借款记录搜索
     */
    @ApiOperation("借款记录搜索")
    @PostMapping("/search/borrow")
    public Result<Pages<BorrowVO>> search(@RequestBody BorrowSearchQuery borrowSearchQuery){
        Pages<BorrowVO> pages = borrowService.search(borrowSearchQuery);
        return Result.ok(pages);
    }
}
